<?php
namespace app\controller;

use app\BaseController;
use \think\facade\Request;
use \think\facade\Cache;
use \think\facade\Db;
use \think\facade\Log;
use think\facade\Filesystem;
class ImageFileSys extends BaseController
{
  // 获取图片列表
  public function lodeImgList()
  {
  	$param = Request::param();
  	$page=$param['page'];
  	$pageSize = $param['pageSize'];
  	$page=($page-1)*$pageSize;
  	$result = Db::table('img_sys')
  				->order('id desc')
  				->limit($page,$pageSize)
  			    ->select();
  	$count = Db::table('img_sys')
  				 ->count();	
  	$data = [];
  	 $data['count']=$count;
  	 $data['result']=$result;				
  	$this->returnJson(200,'操作成功',$data);
  }
  //删除本地图片
   public function delImgCos()
   {
	   $param = Request::param();
	   $savename = $param['savename'];
	   Db::table('img_sys')->delete($param['id']);
	   unlink('storage/' . $savename);
   }
   //删除本地图片
    public function delImgLocal()
    {
   	   $param = Request::param();
   	   $savename = $param['savename'];
   	   Db::table('img_sys')->delete($param['id']);
   	   unlink('storage/' . $savename);
    }
}